﻿@model StudentEditViewModel
@{
    ViewBag.Title = "编辑学生页面";
    var photoPath = "~/images/" + (@Model.ExistingPhotoPath ?? "wala.jpg");
}

<form enctype="multipart/form-data" asp-controller="home" asp-action="edit" method="post" class="mt-3">

    <div asp-validation-summary="All" class="text-danger"></div>

    <input hidden asp-for="Id" />
    <input hidden asp-for="ExistingPhotoPath" />

    <div class="form-group row " style="margin-bottom: 15px;">
        <label asp-for="Name" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input asp-for="Name" class="form-control" placeholder="Name" />
            <span asp-validation-for="Name" class="text-danger"></span>
        </div>
    </div>
    <div class="form-group row " style="margin-bottom: 15px;">
        <label asp-for="EmailAddress" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input asp-for="EmailAddress" class="form-control" placeholder="EmailAddress" />
            <span asp-validation-for="EmailAddress" class="text-danger"></span>
        </div>
    </div>

    <div class="form-group row " style="margin-bottom: 15px;">
        <label asp-for="ClassName" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <input asp-for="ClassName" class="form-control" placeholder="ClassName" />
            <span asp-validation-for="ClassName" class="text-danger"></span>
        </div>
    </div>

    <div class="form-group row " style="margin-bottom: 15px;">
        <label asp-for="Photos" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <div class="custom-file">
                <input asp-for="Photos" multiple class="form-control custom-file-input" />
            </div>
        </div>
    </div>

    <div class="form-group row col-sm-4 offset-4" style="margin-bottom: 15px;">
        <img class="imagesThumbnail" src="@photoPath" asp-append-version="true"/>
    </div>

    <div class="form-group row " style="margin-bottom: 15px;">
        <label asp-for="Major" class="col-sm-2 col-form-label"></label>
        <div class="col-sm-10">
            <select asp-for="Major"
                    class="custom-select mr-sm-2"
                    asp-items="Html.GetEnumSelectList<MajorEnum>()">
                <option value=""> 请选择</option>
            </select>
            <span asp-validation-for="Major" class="text-danger"></span>
        </div>
    </div>

    <div class="form-group row " style="margin-bottom: 15px;">
        <div class="col-sm-10">
            <button type="submit" class="btn btn-primary" asp-controller="home" asp-action="Edit" asp-route-id="@Model.Id">更新</button>
            <button type="submit" class="btn btn-primary" asp-controller="home" asp-action="index">取消</button>
        </div>
    </div>

</form>